package com.example.rentalcar.util;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.example.rentalcar.entity.OssProperties;
import org.springframework.stereotype.Component;

@Component
public class InitOssUtil {

    /**
     * 获取oss相关配置
     */
    static OssUtil ossUtil = new OssUtil();
    static OssProperties ossProperties = ossUtil.getOssProperties();

    public static OSS getOssClient(){
        String endpoint = ossProperties.getEndpoint();
        String accessKeyId = ossProperties.getKeyId();
        String accessKeySecret = ossProperties.getKeySecret();
        return new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
    }
}